//
//  WLGP_GuideViewController.m
//  GuideInternalPurchase
//
//  Created by 王亮 on 2021/1/12.
//  Copyright © 2021 GuideInternalPurchase. All rights reserved.
//

#import "WLGP_GuideViewController.h"
#import "WLGP_GuideView.h"

@interface WLGP_GuideViewController ()<WLGP_GuideViewDelegate>
@property (nonatomic,strong) WLGP_GuideView *guide_view;
@end

@implementation WLGP_GuideViewController
+(void)wl_show:(CloseGuideBlock)CloseGuideBlock{
    [[DLStore singletonMod] initData];
    
//    if ([[[NSUserDefaults standardUserDefaults] stringForKey:AppProcessKey] isEqualToString:CurrentBundleVersion]){
//        return;
//    }
//    [[NSUserDefaults standardUserDefaults] setObject:CurrentBundleVersion forKey:AppProcessKey];
    
    UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;

    WLGP_GuideViewController *showVC = [[WLGP_GuideViewController alloc]init];
    showVC.CloseGuideBlock = CloseGuideBlock;
    
    UINavigationController *navVc = [[UINavigationController alloc]initWithRootViewController:showVC];
    navVc.modalPresentationStyle = UIModalPresentationFullScreen;
    [rootViewController presentViewController:navVc animated:YES completion:^{}];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view addSubview:self.guide_view];
    [self.guide_view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsZero);
    }];
}
#pragma mark -- 导航栏代理
-(UIButton *)set_leftButton{
    UIButton *button = [[UIButton alloc]init];
    [button setTitle:@"关闭" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    return button;
}
-(void)left_button_event:(UIButton *)sender{
    if (self.CloseGuideBlock){
        self.CloseGuideBlock(Guide_Close_Type_Normal);
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark -- WLGP_PayViewDelegate代理
/** 关闭控制器的动作 */
-(void)wl_closeViewType:(Guide_Close_Type)closeType{
    if (self.CloseGuideBlock){
        self.CloseGuideBlock(closeType);
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark -- 懒加载
-(WLGP_GuideView *)guide_view{
    if (!_guide_view){
        _guide_view = [[WLGP_GuideView alloc]init];
        _guide_view.delegate = self;
    }
    return _guide_view;
}
@end
